package com.relytosoft.mizar.analyze.structure.services.controller;

import com.alibaba.fastjson.JSON;
import com.relytosoft.dubhe.common.core.object.ResponseResult;
import com.relytosoft.mizar.analyze.base.entity.pojo.dto.FeatureExtractionReqDto;
import com.relytosoft.mizar.analyze.common.feign.StrategyFeignService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author Jierry
 * @version 2022/5/11.
 */
@RestController
@RequestMapping("/structure/test")
@Api(tags = {"测试接口"})
public class TestController {

    @Resource
    private StrategyFeignService strategyFeignService;

    @GetMapping("/test")
    @ApiOperation("test")
    public ResponseResult test() {
        return strategyFeignService.test();
    }

    @PostMapping("/testFeign")
    @ApiOperation("内部Feign调用结构化图片分析")
    public ResponseResult testFeign() {
        FeatureExtractionReqDto featureExtractionReqDto = new FeatureExtractionReqDto();
        StringBuilder sb = new StringBuilder();
        /*sb.append("");
        featureExtractionReqDto.setImageData(sb.toString());*/
        return strategyFeignService.struFeartureExtraction(JSON.toJSONString(featureExtractionReqDto));
    }
}
